/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.goods.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.file.utils.FileUploadUtils;
import com.jeesite.modules.goods.dao.ZtQuanDao;
import com.jeesite.modules.goods.entity.ZtGoods;
import com.jeesite.modules.goods.entity.ZtQuan;

/**
 * 测试数据Service
 * 
 * @author ThinkGem
 * @version 2018-04-22
 */
@Service
@Transactional(readOnly = true)
public class ZtQuanService extends CrudService<ZtQuanDao, ZtQuan> {
	
	public String getImgFirst(ZtQuan ztQuan){
		return dao.getImgFirst(ztQuan);
	}
	
	
	public ZtQuan getOneQuan(ZtQuan ztQuan){
		return dao.getOneQuan(ztQuan);
	}
	@Transactional(readOnly = false)
	public void updateUsestatus(ZtQuan ztQuan){
		dao.updateUsestatus(ztQuan);
	}
	/**
	 * 获取单条数据
	 * 
	 * @param testData
	 * @return
	 */
	@Override
	public ZtQuan get(ZtQuan ztQuan) {
		ZtQuan entity = super.get(ztQuan);
		if (entity == null) {
			entity = new ZtQuan();
		}
		return entity;
	}

	/**
	 * 查询分页数据
	 * 
	 * @param page
	 *            分页对象
	 * @param testData
	 * @return
	 */
	@Override
	public Page<ZtQuan> findPage(Page<ZtQuan> page, ZtQuan ztQuan) {
		return super.findPage(page, ztQuan);
	}

	/**
	 * 保存数据（插入或更新）
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void save(ZtQuan ztQuan) {
		super.save(ztQuan);
		// 保存上传图片
				FileUploadUtils.saveFileUpload(ztQuan.getId(), "user_upload2");
	}

	/**
	 * 更新状态
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void updateStatus(ZtQuan ztQuan) {
		super.updateStatus(ztQuan);
	}
	@Transactional(readOnly = false)
	public void updateUserstatus(ZtQuan ztQuan) {
		dao.updateUserstatus(ztQuan);
	}
	
	


	/**
	 * 删除数据
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void delete(ZtQuan ztQuan) {
		super.delete(ztQuan);
	}

}